﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace KinectedMusic.Audio
{
    class Song
    {

        private List<IInstrument> instruments = new List<IInstrument>();
        private double beatsPerMinute;
        private int beatsPerBar;

        //TODO: Change to short props... i was noob when c# when i started this..
        public double BeatsPerMinute
        {
            get
            {
                return beatsPerMinute;
            }
            set
            {
                beatsPerMinute = value;
            }
        }

        public int BeatsPerBar
        {
            get
            {
                return beatsPerBar;
            }
            set
            {
                beatsPerBar = value;
            }
        }


        internal IInstrument AddInstrument(string pluginName, int bufferSize)
        {
            Instrument instrument = new Instrument(pluginName);
            instruments.Add(instrument);
            instrument.LoadVST(bufferSize);
            return (IInstrument)instrument;
        }

        internal List<Jacobi.Vst.Core.VstAudioBuffer[]> GetOutputBuffers(double position, double barStep, int bufferSize)
        {
            List<Jacobi.Vst.Core.VstAudioBuffer[]> outputBuffers = new List<Jacobi.Vst.Core.VstAudioBuffer[]>();
            foreach (Instrument intrument in instruments)
            {
                outputBuffers.Add(intrument.GetOutputBuffers(position, barStep, bufferSize));
            }
            return outputBuffers;
        }

        internal List<IInstrument> getInstruments()
        {
            return instruments;
        }


    }
}
